<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组遍历</title>
    <script>
        var arr = [80, 75, 69, 95, 92, 88, 76]; //计算平均分
        var sum = 0;
        for (var i = 0; i < arr.length; i++) {
            sum += arr[i]; //累加求和
        }
        var avg = sum / arr.length; //计算平均分
        console.log(avg.toFixed(2)); //输出结果
        //arr.length获取数组长度
    </script>
</head>

<body>

</body>

</html>